From cb2e4a92f9d83b785dd0071c448ea4d59d8117c7 Mon Sep 17 00:00:00 2001 From: justbur Date: Mon, 10 Aug 2015 11:05:04 -0400 Subject: [PATCH] show-remaining-keys cleanup --- which-key.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/which-key.el b/which-key.el index 79f51c576a2..1da7bf85aad 100644 --- a/which-key.el +++ b/which-key.el @@ -334,16 +334,18 @@ used.") (when which-key-use-C-h-for-paging (setq which-key--prefix-help-cmd-backup prefix-help-command prefix-help-command #'which-key-show-next-page)) + (when which-key-show-remaining-keys + (add-hook 'pre-command-hook #'which-key--lighter-restore)) (add-hook 'pre-command-hook #'which-key--hide-popup) - (add-hook 'pre-command-hook #'which-key--lighter-restore) (add-hook 'focus-out-hook #'which-key--stop-timer) (add-hook 'focus-in-hook #'which-key--start-timer) (which-key--start-timer)) (setq echo-keystrokes which-key--echo-keystrokes-backup) (when which-key-use-C-h-for-paging (setq prefix-help-command which-key--prefix-help-cmd-backup)) + (when which-key-show-remaining-keys + (remove-hook 'pre-command-hook #'which-key--lighter-restore)) (remove-hook 'pre-command-hook #'which-key--hide-popup) - (remove-hook 'pre-command-hook #'which-key--lighter-restore) (remove-hook 'focus-out-hook #'which-key--stop-timer) (remove-hook 'focus-in-hook #'which-key--start-timer) (which-key--stop-timer))) @@ -985,6 +987,7 @@ is the width of the live window." (setq which-key--lighter-backup (cadr (assq 'which-key-mode minor-mode-alist))) (setcar (cdr (assq 'which-key-mode minor-mode-alist)) (format " WK: %s/%s keys" n-shown n-tot)))) + (defun which-key--lighter-restore () "Restore the lighter for which-key." (when which-key-show-remaining-keys -- 2.30.2